#include "reg3volumeattribwidget.h"
#include "reg3volumedatanode.h"

using namespace PBVP;

Reg3VolumeAttribWidget::Reg3VolumeAttribWidget(Reg3DVolumeDataNode *pVolNode, QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);
	m_pVolNode = pVolNode;
	m_pVolData = (Reg3DVolumeData*)m_pVolNode->data();
	QString str;
	ui.funMinLabel->setText(str.setNum(m_pVolData->getMinValue(0)));
	ui.funMaxLabel->setText(str.setNum(m_pVolData->getMaxValue(0)));
	str = QString("(%1, %2, %3)").arg(m_pVolData->width()).arg(m_pVolData->height()).arg(m_pVolData->depth());
	ui.dimLabel->setText(str);
	float orig[3], span[3], minExt[3], maxExt[3];
	m_pVolData->getOrigin(orig);
	m_pVolData->getSpan(span);
	m_pVolData->getMinMaxExt(minExt, maxExt);
	str = QString("(%1, %2, %3)").arg(orig[0]).arg(orig[1]).arg(orig[2]);
	ui.origLabel->setText(str);
	str = QString("(%1, %2, %3)").arg(span[0]).arg(span[1]).arg(span[2]);
	ui.spanLabel->setText(str);
	str = QString("(%1, %2, %3)").arg(maxExt[0]).arg(maxExt[1]).arg(maxExt[2]);
	ui.maxExtLabel->setText(str);
}

Reg3VolumeAttribWidget::~Reg3VolumeAttribWidget()
{

}

void Reg3VolumeAttribWidget::setRenderingProperty(QWidget *renderPropWidget)
{
	if(renderPropWidget) {
		renderPropWidget->setParent(ui.renderPropertyTab);
	}
	//renderPropWidget->setGeometry(5, 5, renderPropWidget->width(), renderPropWidget->height());
	ui.renderPropertyTab->layout()->addWidget(renderPropWidget);
	if(ui.renderPropertyTab->isVisible()) renderPropWidget->show();
}
